<%@page import="main.LogicImageSegmentation"%>
<%@page import="java.io.File"%>

<jsp:useBean id="lis" class="main.LogicImageSegmentation" scope="application"/>
<%

    // get the app path
    String appPath = config.getServletContext().getRealPath("/");
    //System.out.println("APP PATH : "+appPath);
    // data set path                 
    File ff = new File(appPath);
    //String dataSetPath = ff.getParentFile().getParentFile().toString() + "/";     // get /ImageSegmentation/ ..
    String dataSetPath = appPath;   // get /ImageSegmentation/ ..

    int testing_id = Integer.parseInt(request.getParameter("id"));
    int foldcsv = 0;
    int percentps = 0;
    if (request.getParameter("fold") != null) {
        foldcsv = Integer.parseInt(request.getParameter("fold"));
    }
    if (request.getParameter("percent") != null) {
        percentps = Integer.parseInt(request.getParameter("percent"));
    }
    out.println(testing_id + "," + foldcsv + "," + percentps);

    if (lis != null) {
        lis.InisializesInstances(dataSetPath + LogicImageSegmentation.FILE_DATA_SET_NAME_ARFF, LogicImageSegmentation.ARFF_FILE);
        lis.SaveTestOption(testing_id, foldcsv, percentps);
        
        lis.AllOutLearningJSP(dataSetPath + LogicImageSegmentation.FILE_DATA_TEST_NAME_ARFF,dataSetPath + LogicImageSegmentation.FILE_MODEL_NAME_WEKA_IBK, dataSetPath + LogicImageSegmentation.FILE_MODEL_NAME_WEKA_NAIVE_BAYES, dataSetPath + LogicImageSegmentation.FILE_MODEL_NAME_WEKA_ID3, dataSetPath + LogicImageSegmentation.FILE_MODEL_NAME_SI_IBK, dataSetPath + LogicImageSegmentation.FILE_MODEL_NAME_SI_NAIVE_BAYES, dataSetPath + LogicImageSegmentation.FILE_MODEL_NAME_SI_ID3);
        
    }
    
%>

<jsp:forward page="classify.jsp?log=true"/>